package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TbGoodsClassification;
import com.ruoyi.system.mapper.TbGoodsClassificationMapper;
import com.ruoyi.system.service.ITbGoodsClassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class TbGoodsClassificationServiceImpl implements ITbGoodsClassificationService 
{
    @Autowired
    private TbGoodsClassificationMapper tbGoodsClassificationMapper;

    /**
     * 查询商品分类
     * 
     * @param id 商品分类主键
     * @return 商品分类
     */
    @Override
    public TbGoodsClassification selectTbGoodsClassificationById(Long id)
    {
        return tbGoodsClassificationMapper.selectTbGoodsClassificationById(id);
    }

    /**
     * 查询商品分类列表
     * 
     * @param tbGoodsClassification 商品分类
     * @return 商品分类
     */
    @Override
    public List<TbGoodsClassification> selectTbGoodsClassificationList(TbGoodsClassification tbGoodsClassification)
    {
        return tbGoodsClassificationMapper.selectTbGoodsClassificationList(tbGoodsClassification);
    }

    /**
     * 新增商品分类
     * 
     * @param tbGoodsClassification 商品分类
     * @return 结果
     */
    @Override
    public int insertTbGoodsClassification(TbGoodsClassification tbGoodsClassification)
    {
        tbGoodsClassification.setCreateTime(DateUtils.getNowDate());
        return tbGoodsClassificationMapper.insertTbGoodsClassification(tbGoodsClassification);
    }

    /**
     * 修改商品分类
     * 
     * @param tbGoodsClassification 商品分类
     * @return 结果
     */
    @Override
    public int updateTbGoodsClassification(TbGoodsClassification tbGoodsClassification)
    {
        tbGoodsClassification.setUpdateTime(DateUtils.getNowDate());
        return tbGoodsClassificationMapper.updateTbGoodsClassification(tbGoodsClassification);
    }

    /**
     * 批量删除商品分类
     * 
     * @param ids 需要删除的商品分类主键
     * @return 结果
     */
    @Override
    public int deleteTbGoodsClassificationByIds(Long[] ids)
    {
        return tbGoodsClassificationMapper.deleteTbGoodsClassificationByIds(ids);
    }

    /**
     * 删除商品分类信息
     * 
     * @param id 商品分类主键
     * @return 结果
     */
    @Override
    public int deleteTbGoodsClassificationById(Long id)
    {
        return tbGoodsClassificationMapper.deleteTbGoodsClassificationById(id);
    }
}
